//index.js
//获取应用实例
const app = getApp();
//解构赋值
const  { request } =getApp().globalData;

Page({
  data: {
    categories:[],
    swipe:[],
  },
  //事件处理函数
  bindViewTap: function() {
    wx.navigateTo({
      url: '../logs/logs'
    })
  },
  onLoad: async function (options) {
    // 获取轮播图
    let swipe = await request('slides', {
      method: 'get',
      params: {
        a: 1, b: 2
      },
    });
    let categories = await request('categories');
    this.setData({
      categories: categories.data,
      swipe: swipe.data
    });
  },
  getUserInfo: function(e) {
    console.log(e)
    app.globalData.userInfo = e.detail.userInfo
    this.setData({
      userInfo: e.detail.userInfo,
      hasUserInfo: true
    })
  }
})
